package com.bwie.controller;

import com.bwie.pojo.Car;
import com.bwie.pojo.Prod;
import com.bwie.service.ProdService;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author GaoYiJie
 * @Description
 * @Create 2025/3/1 8:30
 * @Version 1.0
 */
@RestController
@RequestMapping("/shop/prod")
public class ProdController {

    @Autowired
    ProdService prodService;

    /**
     * 获取ES商品数据
     * @param pageInfoVo
     * @return
     */
    @PostMapping("/getEsProdByPage")
    public R getEsProdByPage(@RequestBody PageInfoVo pageInfoVo){
        return prodService.getEsProdByPage(pageInfoVo);
    }

    /**
     * 获取商品列表
     * @param
     * @return
     */
    @PostMapping("/getProdList")
    public R getProdList(){
        return prodService.getProdList();
    }

    /**
     * 修改商品
     * @param prod
     * @return
     */
    @PostMapping("/updateProd")
    public R updateProd(@RequestBody Prod prod){
        return prodService.updateProd(prod);
    }


    /**
     * 新增购物车
     * @param car
     * @return
     */
    @PostMapping("/addBuyCar")
    public R addBuyCar(@RequestBody Car car){
        return prodService.addBuyCar(car);
    }
}
